<?php
namespace action\traits;
trait Edit{
    
    function getEidt($id){
        $model = $this->getModel();
        if($_POST){
            $info = I()->clearVar($_POST);
            $info['content'] = gav($_POST, 'content');

            $cond = [
                'id' => $id
            ];
            if($model->update($info, $cond)){
                $this->redirect($this->urldo('index', $id));
            }
            $info = $_POST;
        } else {
            $info = $model->getInfo($id);
            if(!$info){
                $this->redirect($this->urldo('index'));
            }
        }
        
        return $info;
    }

}